<?php
include_once("./function.php");
$sql="select * from ts_sysconfig order by 1 desc";
$res=mysqli_query($link,$sql);
if(is_object($res))
{
	if(mysqli_num_rows($res)>0)
	{
		$sys=array();
		while(($list=mysqli_fetch_assoc($res))!=false)
		{
			$sys[]=$list;
		}
		//print_r($sys);
	}
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>主体部分</title>
<base target="_self">
<link rel="stylesheet" type="text/css" href="skin/css/base.css" />
<link rel="stylesheet" type="text/css" href="skin/css/main.css" />
</head>
<body leftmargin="8" topmargin='8'>
<?php include_once("./function.php");?>
<table width="98%" align="center" border="0" cellpadding="3" cellspacing="1" bgcolor="#CBD8AC" style="margin-bottom:8px;margin-top:8px;">
  <tr>
    <td background="./skin/images/frame/wbg.gif" bgcolor="#EEF4EA" class='title' border="0px"><span><img src='./skin/images/frame/arr3.gif' style='margin-right:10px;'>配置项管理</span></td>
	<td align="right" background="./skin/images/frame/wbg.gif" bgcolor="#EEF4EA" class='title' border="0px"></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td colspan="2">
		<table width="98%" border="0" cellpadding="2" cellspacing="1" bgcolor="#CFCFCF" align="center" style="margin-top:8px">
		
			<tr align="center" bgcolor="#FBFCE2" height="25">
				<td width="6%">ID</td>
				<td>选择</td>
				<td width="15%">配置项标题</td>
				<td width="25%">配置项名称</td>
				<td width="15%">配置项内容</td>
				<td width="15%">配置项类型</td>
				<td>操作</td>
			</tr>
  <!-- data start-->
		<?php 
			if(isset($sys)){foreach($sys as $v){
			
		
		?>
			<tr align='center' bgcolor="#FFFFFF" height="26" align="center" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';">
				<td nowrap><?=$v['sys_id']?></td>
				<td>
						<input type="checkbox" name="net[]" value="<?=$v['sys_id']?>" class="inp" id="arcID"/>
				</td>
				<td><?=$v['sys_title']?></td>
				<td><?=$v['sys_name']?></td>
				<td><?=$v['sys_val']?></td>
				<td><a href='content_list.php?cid=36'><?=$v['sys_type']?></a></td>
				<td>
					<a href="./sys_conf_edit.php?sys_id=<?=$v['sys_id']?>"><img src='./skin/images/frame/trun.gif' title="编辑" alt="编辑" onClick="QuickEdit(179, event, this);" style='cursor:pointer' border='0' width='16' height='16' /></a>
					<a href="./do_sys_conf_del.php?sid=<?=$v['sys_id']?>"><img src='./skin/images/frame/gtk-del.png' title="删除" alt="删除" onClick="editArc(179);" style='cursor:pointer' border='0' width='16' height='16' /></a>
					
				</td>
			</tr>
			<?php }}?>
				</table>
			</td>
		  </tr>
  <!-- data end-->
  <!-- select start-->
	  <tr bgcolor="#ffffff">
		<td height="36" colspan="10">
				<button type="button" onclick="check(1)" style="background:#ffffff;">全选</button>
				<button type="button" onclick="check(2)" style="background:#ffffff;">全不选</button>
				<button type="button" onclick="check(3)" style="background:#ffffff;">反选</button>
				<button type="button" onclick="selDel()" style="background:#ffffff;">删除</button>
				<!--<input type="submit" name="sub" value="删除" onclick="selDel();">-->
		</td>
	  </tr>
  <!-- select end-->
  <!-- page start-->
	  <tr align="right" bgcolor="#F9FCEF">
		<td height="36" colspan="10" align="center">
			<div class="pagelistbox">
				<span class='indexPage'>首页 
				 
				</span><strong>1</strong>
				
				<a class='endPage' href='#'>末页</a> 
				</div>
			</td>
	  </tr>
  <!-- page end-->
  <tr>
	<td colspan="2"><a href="sys_conf_add.php" class="coolbg np">添加配置项</a></td>
  </tr>
</table>
<script type="text/javascript">
inps=document.getElementsByTagName("input");
function check(a)
{
	for(i=0;i<inps.length;i++)
	{
		if(inps[i].type=='checkbox')
		{
			if(a==1)//全选
			{
				inps[i].checked=true;
			}
			else if(a==2)//全不选
			{
				inps[i].checked=false;
			}
			else//反选
			{
				if(inps[i].checked==true)
				{
					inps[i].checked=false;
				}
				else
				{
					inps[i].checked=true;
				}
			}
		}
		
	}
}
arr=document.getElementsByName("inp");
function selAll()
{
	for(var i=0;i<arr.length;i++)
	{
		if(arr[i].type=='checkbox')
		{
			arr[i].ckecked=true;
		}
	}
}
//arr=document.getElementsByName("arcID");
arr=document.getElementsByTagName("input");
function selDel()
{  
	str='';
	for(var i=0;i<arr.length;i++)
	{
		if(arr[i].type=='checkbox')
		{
			if(arr[i].checked==true)
			{
				str+=arr[i].value+',';//由选中id组成的字符串 str=1,3,4,
			}
		}
	}
	if(str!='')
	{
		res=confirm("确定删除?");
	}
	if(res)
	{
		location.href="sys_conf_del.php?ids="+str;
	}
}
</script>
</body>
</html>
